package com.example.demo.rabbitmq.simple;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author 鱼仔
 * @date 2021/7/1 4:37 下午
 * 简单模式的生产者
 */
@Component
public class SimpleSender {

    @Resource
    private AmqpTemplate amqpTemplate;

    private static final String queueName = "simple.test";

    /**
     * 简单模式的消息发送
     */
    public void simpleSend(String msg) {
        amqpTemplate.convertAndSend(queueName, msg);
    }
}
